<?php

namespace app\modules\Admin\models;

use DateTimeInterface;
use Illuminate\Database\Eloquent\Model;

class rankinglistModel extends Model
{

    protected $table = 'ranking_list';
    protected $primaryKey = 'id';
    protected $appends = [];

    protected $hidden = [];

    /**
     * @param DateTimeInterface $date
     * @return string
     */
    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }

    public function member()
    {
        return $this->belongsTo(\memberModel::class, 'member_id', 'id');
    }

    public function agent()
    {
        return $this->hasOne(\memberModel::class, 'id', 'member_id');
    }

    public function gudong()
    {
        return $this->hasOne(\gudongModel::class, 'gudong_id', 'member_id');
    }

    public function tuike()
    {
        return $this->hasOne(\tuikeModel::class, 'tuike_id', 'member_id');
    }

    public function qudai()
    {
        return $this->hasOne(\qudaiModel::class, 'qudai_id', 'member_id');
    }

}